package 尚硅谷juc大厂.test2;

import java.util.concurrent.*;

public class Test22 {


    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 2, 2L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(50));
        CompletableFuture<Integer> future = CompletableFuture.supplyAsync(() -> {
            return 1;
        });

        CompletableFuture<Integer> future2 = CompletableFuture.supplyAsync(() -> {
            return 2;
        },executor);
        System.out.println(future.get());
        System.out.println(future2.get());
        executor.shutdown();
    }
}
